package brcl.controller;

import brcl.annotation.ApiDoc;
import brcl.view.ServerResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO(一句话描述该类的功能，以英文句号结尾)
 *
 * @version v1.0
 * @className: TestController
 * @author: heyiheng
 * @date: 2021-04-16 20:29
 */
@Api(tags = "ui测试")
@RestController("/test")
public class TestController {
	@ApiDoc
	@RequestMapping("/test")
	@ApiOperation(value = "api测试",notes = "api测试",httpMethod = "GET")
	@ApiResponses(@ApiResponse(code = 100,message = "error"))
	public ServerResponse<String> test(@RequestParam("value") Integer value){
		String a = "恭喜你获得神秘大奖！";
		if (value<5){
			return ServerResponse.createBySuccessMessage("这是一个比5小的数");
		}else if(value>=5 && value<20){
			return ServerResponse.createBySuccessMessage("这是一个大于5小于20的数");
		}else if (value>=20 && value<30){
			return ServerResponse.createBySuccess("答对了！",a);
		}
		return ServerResponse.createByErrorMessage("数字大于30，不可识别");
	}
}
